package br.com.sgi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.sgi.dao.AuthoritiesDao;
import br.com.sgi.model.Authorities;
import br.com.sgi.service.AuthoritiesService;

@Service("authoritiesService")
public class AuthoritiesServiceImpl implements AuthoritiesService {
	
	@Autowired
	private AuthoritiesDao authoritiesDao; 
	
	@Override
	public List<Authorities> buscaTodasAuthorities() {

		return authoritiesDao.findAll();
	}

	@Override
	public void salvar(Authorities authorities) {
		if(authorities.getCoSeqAuthorities() == null)
			authoritiesDao.save(authorities);
		else
			atulizar(authorities);
		
	}

	@Override
	public void atulizar(Authorities authorities) {
		authoritiesDao.update(authorities);
		
	}

	
}
